package com.gtw.modules.api.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import com.gtw.modules.api.service.TbRaidDetailsService;
import com.gtw.modules.dao.TbRaidDetailsDao;
import com.gtw.modules.entity.TbRaidDetails;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/** 佣金明细接口实现类
 * Created by wuye on 2018/1/25.
 */
@Service
public class TbRaidDetailsServiceImpl implements TbRaidDetailsService {

    @Autowired
    private TbRaidDetailsDao tbRaidDetailsDao;

    /**
     * 根据条件查询佣金明细
     * @param pageUtil
     * @param map
     * @return
     */
    @Override
    public Page<TbRaidDetails> queryPageList(Page<TbRaidDetails> pageUtil, Map<String, Object> map) {
        pageUtil.setRecords(tbRaidDetailsDao.queryPageList(pageUtil, map));
        return pageUtil;
    }

    /**
     * 保存佣金明细
     * @param tbRaidDetails
     */
    @Override
    @Transactional(rollbackFor=Exception.class)
    public void save(TbRaidDetails tbRaidDetails) {
        tbRaidDetailsDao.insert(tbRaidDetails);
    }

    @Override
    public List<TbRaidDetails> queryBybenefit(Integer benefitUserid) {
        return tbRaidDetailsDao.queryBybenefit(benefitUserid);
    }

    @Override
    public List<TbRaidDetails> queryBytrigger(Integer triggerUserid) {
        return tbRaidDetailsDao.queryBytrigger(triggerUserid);
    }

}
